/*
 * Copyright 2014 stanislawbartkowski@gmail.com 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * http://www.apache.org/licenses/LICENSE-2.0 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */
package com.jython.ui;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.math.BigDecimal;

import org.junit.Test;

import com.gwtmodel.table.common.DecimalUtils;
import com.jythonui.server.ISharedConsts;
import com.jythonui.server.dict.DictEntry;
import com.jythonui.server.dict.VatTax;

public class Test39 extends TestHelper {

    @Test
    public void test1() {
        assertEquals(5, iListV.getList().size());
        int ok = 0;
        for (DictEntry e : iListV.getList()) {
            VatTax r = (VatTax) e;
            assertNotNull(r.getName());
            assertNotNull(r.getDescription());
            String level = r.getAttr(ISharedConsts.VATLEVELPROP);
            System.out.println(level);
            BigDecimal b = r.getVatLevel();
            if (b != null) {
                System.out.println(b);
                if (b.equals(DecimalUtils.toBig("0")))
                    ok++;
                if (b.equals(DecimalUtils.toBig("7")))
                    ok++;
                if (b.equals(DecimalUtils.toBig("20")))
                    ok++;
                if (b.equals(DecimalUtils.toBig("22")))
                    ok++;
            }
        }
        System.out.println("ok=" + ok);
        assertEquals(3, ok);
    }

}
